SPA_RESOLVE_INIT = function(transition) {
    var html = '<div class="infoList">\n' +
        '<div class="items">\n' +
        '<label>昵称</label><input type="text" class="input-txt" id="nickname_t"/>\n' +
        '</div>\n' +
        '<div class="items">\n' +
        '<label>邮箱</label><input type="text" class="input-txt" id="email_t"/>\n' +
        '</div>\n' +
        '<div class="items">\n' +
        '<label>电话</label><input type="text" class="input-txt" maxlength="11" id="telephone_t"/>\n' +
        '</div>\n' +
        '<div class="items mt-50">\n' +
        '<label></label>\n' +
        '<a class="info-btn f-16 c-21a text-center rad-3 float-left mr-100" onclick="showinfo()">还原</a>\n' +
        '<a class="submit-btn f-16 c-fff text-center rad-3 float-left" onclick="updateFun()">提 交</a>\n' +
        '</div>\n' +
        '</div>';
    $(".info-tables").html(html);
    $(".infoUL li").eq(1).addClass("active").siblings("li").removeClass("active");
    $(".info-area .title").html("修改基本信息");
    showinfo();
}

function showinfo() {
    $.ajax({
        url: search_user_interface,
        type:'post',
        dataType:'json',
        xhrFields:{
            withCredentials:true
        },
        crossDomain:true,
        data:{
            username:getUserName()
        },
        success: function(data) {
            if(data.code==200){
                $("#nickname_t").val(data.data.nickname);
                $("#email_t").val(data.data.email);
                $("#telephone_t").val(data.data.telephone);
            }
            else{
                $.message(data.msg);
            }
        },
        error: function () {
            $.message("链接超时，请刷新...");
        }
    });
}


function updateFun(){

    var nickname = $("#nickname_t").val();
    var email = $("#email_t").val();
    var telephone = $("#telephone_t").val();

    if(nickname==""){
        $.message("请填写昵称");
        return ;
    }
    if(email==""){
        $.message("请填写邮箱");
        return ;
    }
    if(telephone==""){
        $.message("请填写手机号");
        return ;
    }
    $.ajax({
        url: update_interface,
        type:'post',
        dataType:'json',
        xhrFields:{
            withCredentials:true
        },
        crossDomain:true,
        data:{
            nickname:nickname,
            email:email,
            telephone:telephone
        },
        success: function(data) {
            if(data.code==200){
                $.message("修改成功");
            }else{
                $.message(data.msg);
            }
        },
        error: function () {
            $.message("链接超时，请刷新...");
        }
    });
}